#define  _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
class Solution {
public:
    bool zimu(char ch) {
        if (ch >= 'a' && ch <= 'z') {
            return true;
        }
        else if (ch >= 'A' && ch <= 'Z') {
            return true;
        }
        else {
            return false;
        }
    }
    string reverseOnlyLetters(string s) {
        if (s.empty()) {
            return s;
        }
        int begin = 0;
        int end = s.size() - 1;
        while (begin < end) {
            while (begin < end && zimu(s[begin]) == false) {
                ++begin;
            }
            while (begin < end && zimu(s[end]) == false) {
                --end;
            }
            swap(s[begin], s[end]);
            begin++;
            end--;
        }
        return s;
    }
};

class Solution1 {
public:
    int firstUniqChar(string s)
    {
        for (int i = 0; i < s.size(); ++i)
        {
            int index = s.find(s[i]);
            int reverse_index = s.rfind(s[i]);
            if (index == reverse_index)
                return i;
        }
        return -1;
    }
};

class Solution2 {
public:
    string addStrings(string num1, string num2) {
        string str;
        int end1 = num1.size() - 1;
        int end2 = num2.size() - 1;
        int next = 0;
        while (end1 >= 0 || end2 >= 0) {
            int val1 = 0;
            int val2 = 0;
            if (end1 >= 0) {
                val1 = num1[end1] - '0';
            }
            if (end2 >= 0) {
                val2 = num2[end2] - '0';
            }
            int ret = val1 + val2 + next;
            next = ret / 10;
            ret %= 10;
            str.insert(str.begin(), '0' + ret);
            --end1;
            --end2;
        }
        if (next == 1) {
            str.insert(str.begin(), '1');
        }
        return str;
    }
};

class Solution3 {
public:
    string addStrings(string num1, string num2) {
        string str;
        int end1 = num1.size() - 1;
        int end2 = num2.size() - 1;
        int next = 0;
        while (end1 >= 0 || end2 >= 0) {
            int val1 = 0;
            int val2 = 0;
            if (end1 >= 0) {
                val1 = num1[end1] - '0';
            }
            if (end2 >= 0) {
                val2 = num2[end2] - '0';
            }
            int ret = val1 + val2 + next;
            next = ret / 10;
            ret %= 10;
            str += ('0' + ret);
            --end1;
            --end2;
        }
        if (next == 1) {
            str += ('1');
        }
        reverse(str.begin(), str.end());
        return str;
    }
};

#include <iostream>
#include <string>
using namespace std;

int main() {
    string str;
    getline(cin, str);
    size_t pos = str.rfind(' ');
    if (pos != string::npos) {
        cout << str.size() - 1 - pos << endl;
    }
    else {
        cout << str.size() << endl;
    }
}